using System;
using Microsoft.AspNetCore.Authorization;

namespace JGSY.CMS.LowCode.Platform.Infrastructure.Authorization
{
    /// <summary>
    /// 统一权限特性：等价于 [Authorize(Policy = code)]
    /// 用法：[RequirePermission("user.view")]
    /// </summary>
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
    public sealed class RequirePermissionAttribute : AuthorizeAttribute
    {
        public RequirePermissionAttribute(string code)
        {
            Policy = code;
        }
    }
}
